

# 贪婪搜索算法
def OneMove(env, player, nowstate):

    moves = env.getAllLegalMove(nowstate, player)
    bestMove = "P"
    bestValue = 0
    for move in moves:
        dis = env.getActionNum(nowstate, move)
        if dis in env.reward_states.keys():
            if env.reward_states[dis] > bestValue:
                bestMove = move
                bestValue = env.reward_states[dis]

    return bestMove

